'its a simple IRC Bot written in F#.

#light
open System.Net.Sockets
open System.IO
open System
open System.Text.RegularExpressions
//Opens any needed namespaces
let tcp = new TcpClient();
tcp.Connect("irc.freenode.net",6667)
//Connects and creates streams for the connection.
let reader = new StreamReader(tcp.GetStream())
let writer = new StreamWriter(tcp.GetStream())
writer.WriteLine("USER FSharpBot FSharpBot FSharpBot FSharpBot")
writer.AutoFlush <- true
writer.WriteLine("NICK FSharpBot")
//Log in and create a loop that will keep the bot open.
while(reader.EndOfStream = false) do 
        let line = reader.ReadLine()
        Console.WriteLine(line) 
        //msg is what someone said without the raw irc code.
        let msg = line.Substring(line.Substring(1).IndexOf(":") + 2)
        //Console.WriteLine(msg))
        if (line.Contains("PING")) then
                writer.WriteLine("PONG :irc.freenode.net")